<template>
  <a-config-provider :locale="locale">
    <div id="app">
      <router-view />
    </div>
  </a-config-provider>
</template>

<script>
import { domTitle, setDocumentTitle } from '@/utils/domUtil'
import { getCommonConfig } from '@/api/common'
import { i18nRender } from '@/locales'
import storage from 'store'
import { ADMIN_TITLE } from '@/store/mutation-types'

export default {
  data() {
    return {}
  },
  computed: {
    locale() {
      // 只是为了切换语言时，更新标题
      const { title } = this.$route.meta
      title && setDocumentTitle(`${i18nRender(title)} - ${storage.get(ADMIN_TITLE)||domTitle}`)
      return this.$i18n.getLocaleMessage(this.$store.getters.lang).antLocale
    },
  },
  created() {
    getCommonConfig().then((res) => {
      storage.set(ADMIN_TITLE, res.data.title)
    })
  }
}
</script>
<style lang="less">
//.ant-pro-page-header-wrap-children-content {
//  margin: 24px 24px 0;
//  height: calc(100vh - 160px);
//  overflow: auto;
//}
//.ant-pro-page-header-wrap-children-content > .ant-card {
//  height: 100%;
//  overflow: auto;
//}
.ant-layout-footer {
  display: none;
}
.ant-layout-content {
  display: flex;
  flex-direction: column;
  flex: none !important;
}
.ant-pro-basicLayout-content {
  flex: 1 !important;
}
.ant-pro-grid-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.ant-pro-basicLayout-children-content-wrap {
  flex: 1;
}
.ant-pro-page-header-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}
</style>
